module params_mod
  use constants_mod
  implicit none

  character(30) planet
  character(10) topo_type
  character(512) topo_file

  integer :: nx = 0
  integer :: ny = 0
  integer :: nc = 0
  integer :: nz = 1
  
  integer :: recon_h_order    = 5
  integer :: topo_deriv_order = 2 ! topo derivative accuracy order, choose from 2,4,6
  integer :: GaussQuadOrder   = 3
  integer :: stencil_width    = 5
  
  integer :: nQuadPointsOnCell
  integer :: nPointsOnEdge
  
  integer :: halo_width
  integer :: recBdy
  integer :: ext_width
  
  character(10):: recon_h_scheme = 'WENO2D' ! Choose from Polynomial, WENO1D, WENO2D
  
  real(r_kind) :: dx, dy, dz

  namelist /hope_init/ &
    planet           , &
    topo_type        , &
    topo_file        , &
    nx               , &
    ny               , &
    nc               , &
    nz               , &
    recon_h_order    , &
    topo_deriv_order , &
    GaussQuadOrder   , &
    recon_h_scheme

contains

  subroutine params_init(file_path)

    character(*), intent(in) :: file_path

    open(10, file=file_path, status='old')
    read(10, nml=hope_init)
    close(10)
    
    halo_width        = ( recon_h_order + 1 ) / 2
    recBdy            = ( recon_h_order - 1 ) / 2
    ext_width         = halo_width + topo_deriv_order / 2
    stencil_width     = recon_h_order
    
    nQuadPointsOnCell = GaussQuadOrder**2
    nPointsOnEdge     = GaussQuadOrder
    
  end subroutine params_init

end module params_mod
